package com.songlanyun.modules.coupon.entity;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.songlanyun.common.drive.RootEntity;
import com.songlanyun.common.enums.CouponConstant;
import com.songlanyun.modules.order.entity.Order;
import lombok.Data;

/**
 * 优惠券领取记录与使用情况
 *
 * @author lubo
 * @email sunlightcs@gmail.com
 * @date 2022-07-05 15:20:02
 */
@Data
@TableName("yxt_coupon_receive_record")
public class CouponReceiveRecordEntity extends RootEntity<Long, CouponReceiveRecordEntity> implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 *
	 */
	@TableId
	private Long id;
	/**
	 * 用户id
	 */
	private Long userId;
	/**
	 * 优惠券id
	 */
	private Long couponId;
	/**
	 * 过期时间
	 */
	private Date receiveTime;
	/**
	 * 使用时间
	 */
	private Date useTime;
	/**
	 * 过期时间
	 */
	private Date expireTime;
	/**
	 * 0，未使用，1已使用
	 */
	private Boolean useStatus;

	public Boolean isExpire()
	{
		return DateUtil.compare(this.expireTime,new Date())<0;
	}

	@Override
	public Long getIdentity() {
		return getId();
	}
}
